package cn.wolfcode.wolf2w.business.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {
    public static Date getEndDate(Date date){
        Calendar c = Calendar.getInstance();
        c.setTime(date);
//        c.set(Calendar.HOUR_OF_DAY,23);
//        c.set(Calendar.MINUTE,59);
        c.set(Calendar.SECOND,59);
        return c.getTime();
    }

    //返回两个日期对象之间差的秒数
    public static long getBetweenTime(Date date1,Date date2){
        long t = (date1.getTime() - date2.getTime()) / 1000;
        if(t == 0){
//            t = 24 * 60 * 60;
            t = 60;
        }
        return Math.abs(t);
    }
}
